package edu.cuit.zhuyimeng.framework.common.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 飞机状态枚举类
 */
@Getter
@AllArgsConstructor
public enum FlightStatus {

    PREPARING(1,"准备中"),
    BOOKING(2,"订票中"),
    WAITING_TAKEOFF(3,"等待起飞"),
    FLYING(4,"飞行中"),
    ENDED(5,"已结束");

    private final Integer type;
    private final String info;

    //通过type获取FlightStatus
    public static FlightStatus getFlightStatusByType(Integer type){
        for (FlightStatus flightStatus : FlightStatus.values()) {
            if (flightStatus.getType().equals(type)){
                return flightStatus;
            }
        }
        return null;
    }

    public FlightStatus nextPhase() {
        int nextType = type + 1;
        return getFlightStatusByType(nextType);
    }



}
